package com.arrays;

import com.insideClass.Stack;

import java.time.Month;
import java.util.LinkedList;

/**
 * @author 13699
 */
public class Stacks {
    public static void main(String[] args) {
        java.util.Stack<String> stack=new java.util.Stack<>();
        for (Month m:
             Month.values()) {
            stack.push(m.toString());
        }
        System.out.println("stack="+stack);
        stack.addElement("The last line");
        System.out.println("element 5="+stack.elementAt(5));
        System.out.println("popping elements");
        while (!stack.empty()){
            System.out.println(stack.pop());
        }
        LinkedList<String> lstack=new LinkedList<>();
        for (Month m:
             Month.values()) {
            lstack.addFirst(m.toString());
        }
        System.out.println("lstack="+lstack);
        while (!lstack.isEmpty()){
            System.out.println(lstack.removeFirst()+" ");
        }

    }
}
